]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
altTab: Factor out thumbnail creation
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 4 Dec 2012 15:26:00 +0000 (16:26 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Wed, 5 Dec 2012 17:42:08 +0000 (18:42 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=688913

js/ui/altTab.js

index e605fd6c7cded05f664182f48e5e6345984731f5..83b1d3c05fe965dc70bf6db86d91efdc9e1d73bd 100644 (file)
@@ -20,6 +20,20 @@ const THUMBNAIL_FADE_TIME = 0.1; // seconds
 
 const iconSizes = [96, 64, 48, 32, 22];
 
+function _createWindowClone(window, size) {
+    let windowTexture = window.get_texture();
+    let [width, height] = windowTexture.get_size();
+    let scale = Math.min(1.0, size / width, size / height);
+    return new Clutter.Clone({ source: windowTexture,
+                               width: width * scale,
+                               height: height * scale,
+                               x_align: Clutter.ActorAlign.CENTER,
+                               y_align: Clutter.ActorAlign.CENTER,
+                               // usual hack for the usual bug in ClutterBinLayout...
+                               x_expand: true,
+                               y_expand: true });
+};
+
 const AppSwitcherPopup = new Lang.Class({
     Name: 'AppSwitcherPopup',
     Extends: SwitcherPopup.SwitcherPopup,
@@ -621,14 +635,7 @@ const ThumbnailList = new Lang.Class({
             if (!mutterWindow)
                 continue;
 
-            let windowTexture = mutterWindow.get_texture ();
-            let [width, height] = windowTexture.get_size();
-            let scale = Math.min(1.0, THUMBNAIL_DEFAULT_SIZE / width, availHeight / height);
-            let clone = new Clutter.Clone ({ source: windowTexture,
-                                                reactive: true,
-                                                width: width * scale,
-                                                height: height * scale });
-
+            let clone = _createWindowClone(mutterWindow, THUMBNAIL_DEFAULT_SIZE);
             this._thumbnailBins[i].set_height(binHeight);
             this._thumbnailBins[i].add_actor(clone);
             this._clones.push(clone);